<%--@include file="/include.jsp"--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" session="true" errorPage="/runtimeError.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>


<jsp:useBean id="table" type="jetbrains.buildServer.cuta.logic.sheet.Table" scope="request"/>
<jsp:useBean id="pgdef" type="jetbrains.buildServer.cuta.logic.PageDef" scope="request"/>
<jsp:useBean id="subtabber" type="jetbrains.buildServer.cuta.logic.SubTabber" scope="request"/>


<style type="text/css">

    #subTabber
    {
        margin: 5px 0 3ex 0
    }

    #subTabber
    {

    }

    #matrixSheet
    {
        margin: 2ex 1px;
    }

    #matrixSheet td, #matrixSheet th
    {
        padding: 1px 3px;
    }

</style>



<c:if test="${subtabber.showSubTabs}">
    <div class="simpleTabs" style="display: block;">
        <ul id="subTabber" class="tabs">
            <c:forEach var="subtab" items="${subtabber.subTabs}" varStatus="pos">
                <c:if test="${subtab.id == subtabber.currentTabId}">
                    <li class="selected<c:if test='${pos.first}'> first</c:if><c:if test='${pos.last}'> last</c:if>"><p><a href="agents.html?tab=${subtabber.mainTabId}&subtab=${subtab.id}"><b>${subtab.name}</b></a></p></li>
                </c:if>
                <c:if test="${subtab.id != subtabber.currentTabId}">
                    <li class="<c:if test='${pos.first}'> first</c:if><c:if test='${pos.last}'> last</c:if>"><p><a href="agents.html?tab=${subtabber.mainTabId}&subtab=${subtab.id}">${subtab.name}</a></p></li>
                </c:if>
            </c:forEach>
        </ul>
    </div>
    <br/>
</c:if>


<h3>${pgdef.title}</h3>


<div>

    <div class="header">
        ${pgdef.header}
    </div>

    <table id="matrixSheet" class="dark borderBottom sortable" cellspacing="0">

        <tr>
            <c:forEach var="column" items="${table.columns}">
                <th>
                    <span class="sortable <c:if test='${column.sortedAsc}'>sortedAsc</c:if><c:if test='${column.sortedDesc}'>sortedDesc</c:if>"
                          onclick="document.location='${column.onClickRef}'"
                        >${column.captionForShow}</span>
                </th>
            </c:forEach>
        </tr>

        <c:forEach var="row" items="${table.rows}">
            <tr>
                <c:forEach var="cell" items="${row.cells}">
                    <td>${cell.html}</td>
                </c:forEach>
            </tr>
        </c:forEach>

    </table>

    <div class="footer">
        ${pgdef.footer}
    </div>

</div>
